<template>
  <div class="header">
      <header class="top">
      <span @click="back">返回</span>
      <span v-text="title"></span>
    </header>
  </div>
</template>

<script>
export default {
name:'header',
data(){
    return{
        title:"标题"
    }
},
created(){
    this.$store.commit('getHeaderTitle',this.title)
},
methods:{
     back() {
      this.$router.back();
    },
},
}
</script>

<style>
.top {
  height: 0.4rem;
  width: 100%;
  background-color: rgb(80, 143, 238);
}
.top > span {
  color: white;
  line-height: 0.4rem;
  margin-left: 0.2rem;
}
.top > span:nth-child(2) {
  margin-left: 1.2rem;
  font-weight: bold;
}
</style>